package io.sage.modules.goods.service.impl;

import io.sage.modules.goods.entity.BGoodsRecord;
import io.sage.modules.goods.dao.BGoodsRecordMapper;
import io.sage.modules.goods.service.BGoodsRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 物品检查记录表(BGoodsRecord)表服务实现类
 *
 * @author zxh
 * @since 2019-08-13 10:03:11
 */
@Service("bGoodsRecordService")
public class BGoodsRecordServiceImpl implements BGoodsRecordService {
    @Resource
    private BGoodsRecordMapper bGoodsRecordMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BGoodsRecord queryById(Integer id) {
        return this.bGoodsRecordMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @return 对象列表
     */
    @Override
    public List<BGoodsRecord> queryAll(BGoodsRecord bGoodsRecord) {
        return this.bGoodsRecordMapper.queryAll(bGoodsRecord);
    }

    /**
     * 新增数据
     *
     * @param bGoodsRecord 实例对象
     * @return 实例对象
     */
    @Override
    public BGoodsRecord insert(BGoodsRecord bGoodsRecord) {
        this.bGoodsRecordMapper.insert(bGoodsRecord);
        return bGoodsRecord;
    }

    /**
     * 修改数据
     *
     * @param bGoodsRecord 实例对象
     * @return 实例对象
     */
    @Override
    public BGoodsRecord update(BGoodsRecord bGoodsRecord) {
        this.bGoodsRecordMapper.update(bGoodsRecord);
        return this.queryById(bGoodsRecord.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bGoodsRecordMapper.deleteById(id) > 0;
    }
    /**
     * 查询多条数据
     *
     * @param map
     * @return 对象列表
     */
    @Override
    public List queryByMap(Map<String, Object> map) {
        return this.bGoodsRecordMapper.queryByMap(map);
    }
}